<?php
class comment_controller_admin_index extends AdminController {
	
		private $admin;
		public  $data;
		public  $type;
		public  $pageinfo;
		public  $act;
	
	
	public function __construct($app, $controller, $standalone = true)
	{
		
			parent::__construct($app, $controller, $standalone);		
			$this->admin = new comment_model_admincomment();
		
	}
	
	public function index_action()
	{			
			$page	= _('page',1);
			$verify = _('verify',0); $isdelete = _('isdelete',0); if(!$isdelete) $isdelete = 0;
			$data = $this->admin->getAllCommentDate($page,$verify, $isdelete);		
			$this->data		= $data['ROWS'];
			$this->pageinfo = $this->genPages($data['INFO'], array('page'=>$page, 'verify'=>$verify, 'isdelete'=>$isdelete));

	}
	
	//审核 删除 操作
	public  function check_verify_action()
	{
			$verify = _('verify');
			$pass_str = ''; $del_str = '';
			foreach ($verify as $key=>$v) {
				if ($v == 1) { $del_str .= $key.',';  } //删除
				if ($v == 0) { $pass_str .= $key.',';  } //通过
			}
			if($del_str)  {
				$del_str = substr($del_str,0,-1);
				$this->admin->delVerifyData($del_str);
			}
			if($pass_str) {
				$pass_str = substr($pass_str,0,-1);
				$this->admin->passVerifyData($pass_str);
			}
			$data['verify'] = 1 ;
			$this->act = $data;
			$this->view = 'submit';
	}
	
	//恢复删除
	public function recover_del_action()
	{
			$id = _('id');
			if ($id) {
				$this->admin->recoverdata($id);
			}
			$data['isdelete'] = 2 ;
			$data['verify'] = 1 ;
			$this->act = $data;
			$this->view = 'submit';
	}
	
	//搜索日志
	public function search_action()
	{
			$uid		= _('uid',0); 				$page		= _('page', 1);
			$starttime  = _('start',0);				$endtime	= _('end',0);
			$result		= $this->admin->searchCommentDate($page , $uid , $starttime , $endtime);
			$this->pageinfo = $this->genPages($result['INFO'], array('page'=>$page, 'uid'=>$uid, 'starttime'=>$starttime, 'endtime'=>$endtime ));
			$this->data		= $result['ROWS'];
			$this->view		= 'index';
	}
}